package com.wxmit.ot.gen.domain.dto;

import com.wxmit.ot.gen.domain.GenTableColumn;
import com.wxmit.ot.gen.enums.Db2JavaFieldEnum;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * GenTableInitDto
 *
 * @author huangxiong
 * @version V1.0
 * @date 2023/2/23 16:36
 */
@Data
public class GenTableInitDto {

    @NotNull(message = "表名不能为空")
    private String name;
    private String comment;
    private String dbType = Db2JavaFieldEnum.DB_MYSQL;
    @NotEmpty(message = "表格不可没有列信息")
    private List<GenTableColumnInitDto> columns;


    @Data
   public static class GenTableColumnInitDto{
        @NotNull(message = "列名不能为空")
        private String name;
        @NotNull(message = "列类型不能为空")
        private String type;
        private String comment;
        private String isPk;
        private String defVal;
        private String isRequired;
    }
}
